0ed084f18b2c3f73d628222c719a886c812e93e6,src/org/openstreetmap/josm/data/coor/LatLon.java,LatLon,heading,#LatLon#,186
Before Change
*/
public double heading(LatLon other) {
double rv;
if (other.lat() == lat()) {
rv = (other.lon()>lon() ? Math.PI / 2 : Math.PI * 3 / 2);
} else {
rv = Math.atan((other.lon()-lon())/(other.lat()-lat()));
if (rv < 0) {
rv += Math.PI;
}
After Change
* @return heading in the range 0 <= hd < 2*PI
*/
public double heading(LatLon other) {
double hd = atan2(sin(toRadians(this.lon() - other.lon())) * cos(toRadians(other.lat())),
cos(toRadians(this.lat())) * sin(toRadians(other.lat())) -
sin(toRadians(this.lat())) * cos(toRadians(other.lat())) * cos(toRadians(this.lon() - other.lon())));
hd %= 2 * PI;